<template>
	<view class="content" v-if="pageshow">
		<view class="padding">
			<!-- 商品 -->
			<view class="ffffff padding radius">
					<view class="hei word_hh margin_right2">{{dataAll.shop.name}}</view>
				<view class=" xiahuax margin_top" v-for="item in dataAll.goods" :key="item.id">
					<view class="flexbetween">
						<view class="shilitu">
							<image :src="item.image_text" mode=""></image>
						</view>
						<view class="" style="width: 74%;">
							<view class="flexbetween">
								<view class="ershib yhxiank word_baiba black">{{item.title}}</view>
								<view class="qianshu">¥{{item.price}}</view>
							</view>
							<view class="flexbetween margin_top">
								<view class="jiu margin_top1 yhxiank">{{item.difference}}</view>
								<view class="qianshu">X{{item.number}}</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<!-- 商品详情 -->
			<view class=" ">
				<view class="ffffff padding radius margin_top"> 
					<view class="flexbetween  ">
						<view class="word_rb hei">订单编号</view>
						<view class="huisetext">{{dataAll.order_no}}</view>
					</view>
					<view class="flexbetween margin_top">
						<view class="word_rb hei">联系人</view>
						<view class="huisetext">{{dataAll.shopconfig.returnName}}</view>
					</view>
					<view class="flexbetween margin_top">
						<view class="word_rb hei">联系电话</view>
						<view class="huisetext">{{dataAll.shopconfig.returnPhoneNum}}</view>
					</view>
					<view class="flexbetween margin_top">
						<view class="word_rb hei">创建时间</view>
						<view class="huisetext">{{dataAll.createtime_text}}</view>
					</view>
				</view>
			</view>
			<!-- 固定底部 -->
			<view class="gudingdb ffffff"  @click="show = true">
			 <view class="bigbtn">确认核销</view>
			</view>
		</view>
			<u-modal :show="show" @confirm="hexiao" @cancel="show=false":title="title" :content='content' :showCancelButton='true' confirmColor="rgba(255, 117, 16, 1)">
				<view class="affirm">确认要核销么？</view>
			</u-modal>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				show:false,
				dataAll: {},// 订单详情
				tour_order_id:0,
				pageshow:false
			}
		},
		onLoad(optios) {
			let _this = this
			// #ifdef MP-WEIXIN
			const url = decodeURIComponent(optios.q) // 获取到二维码原始链接内容
			if (url.indexOf("?") != -1) {
				var str = url.substr(url.indexOf("?") + 1);
				var strs = str.split("&");
				let theRequest = {};
				for (var i = 0; i < strs.length; i++) {
					theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
				}
				_this.tour_order_id = optios.tour_order_id ? optios.tour_order_id : (theRequest.tour_order_id ? theRequest.tour_order_id :
					0);
			}
			// #endif
			
		},
		onShow() {
			let _this=this
			_this.init()
		},
		methods: {
			
			init() {
				let _this = this;
				httpRequest.request('api/order/getOrderInfo', 'GET', {
					id:this.tour_order_id,
				}, false, false, true).then(res => {
					if (res.code == 1) {
						this.dataAll = res.data
						this.pageshow = true
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			hexiao(){
				if (!httpRequest.checkIsLogin()) {
					httpRequest.doLogin();
					return false;
				}
				httpRequest.request('api/order/hxOrder', 'GET', {
					id: this.tour_order_id,
				}, false, false, true).then(res => {
					httpRequest.toast(res.msg)
					this.show=false
					if (res.code == 1) {
						setTimeout(()=>{
							uni.reLaunch({
								url:"/pages/index/index"
							})
						},500)
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	.bigbtn {
		background-color: RGBA(255, 92, 0, 1);
		border-radius: 41rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: 82rpx;
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
	}
	.affirm{
		font-size: 32rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #000000;
		padding: 40rpx 0rpx;
	}
	.hexiao{
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #000000;
	}
	.erwie{
		width: 169rpx;
		height: 169rpx;
	}
	.code{
		padding: 30rpx 30rpx;
		margin-top: 30rpx;
		background-color: #fff;
	}
	/deep/.u-safe-area-inset-bottom {
		padding-bottom: 0;
		padding-bottom: constant(safe-area-inset-bottom);
	}

	.fuzhi {
		padding: 0rpx 100rpx;
	}

	.copy {
		padding: 20rpx 40rpx;
		border-radius: 51rpx;
		background-color: RGBA(255, 117, 16, 1);
		margin-top: 109rpx;
		color: #fff;
	}

	.dan {
		padding: 64rpx 40rpx 64rpx 40rpx;
	}

	.zhongtong {
		margin-top: 87rpx;
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #000000;
		padding: 34rpx 82rpx;
		border: 1rpx solid rgba(223, 223, 223, 1);
		border-radius: 10rpx;
	}

	.wuliu {
		font-size: 40rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #000000;
	}

	.strongtext {
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #333333;
	}

	.bigtext {
		font-size: 34rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #333333;
	}

	.xzqianshu {
		font-size: 28rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: rgba(255, 117, 16, 1);
	}

	.huangsebtn {
		border: 2rpx solid rgba(255, 117, 16, 1);
		width: 170rpx;
		height: 67rpx;
		display: flex;
		border-radius: 120rpx;
		align-items: center;
		justify-content: center;
		font-size: 26rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: rgba(255, 117, 16, 1);
	}

	.huisebtn {
		border: 2rpx solid #666666;
		width: 170rpx;
		height: 67rpx;
		display: flex;
		border-radius: 120rpx;
		align-items: center;
		justify-content: center;
		font-size: 26rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #666666;
	}

	.shuliang {
		font-size: 26rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #999999;
	}

	.ershib {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #333333;
	}

	.shilitu {
		width: 134rpx;
		height: 128rpx;
		border-radius: 14rpx;

		image {
			width: 100%;
			height: 100%;
			border-radius: 14rpx;
		}
	}

	.qianshu {
		font-size: 28rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: rgba(255, 117, 16, 1);
	}

	.huisetext {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #666666;
	}

	.yhxiank {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
 
</style>